In highly-integrated memory chips, defective memory cells that do not perform a desired operation exist due to variations of processing accuracy at the time of manufacture of individual memory cells (1-bit memory elements). Therefore, in a read-only memory such as a ROM or a PROM, when a defective memory cell that is capable of storing only either “0” or “1” is made to store a value that cannot be stored in the defective memory cell, the value of each data bit in the bit sequence is inverted and stored, and an additional memory component stores the information indicating that the data has been inverted. At the time of data reading, the information stored in the additional memory component is referred to. If the information indicates that the data has been inverted at the time of data storage, the read data is inverted before use.
In a MRAM or ReRAM, each memory cell is in a low-resistance state or a high-resistance state, and data is stored by associating one of the states with the logical value “0” and the other one of the states with the logical value “1.” At the time of data reading in such a MRAM or ReRAM, a check is made to determine whether the logical value is “0” or “1” (or “1” or “0”), based on whether the resistance value of the memory cell is smaller or larger than a threshold value.
In such a memory, a defective memory cell that has a resistance value smaller (or larger) than the threshold value may exist, regardless of whether the defective memory cell is in a low-resistance state or a high-resistance state. Therefore, either “0” or “1” is invariably read from such a defective memory cell, regardless of whether “0” is written or whether “1” is written.
To recover defective memory cells of a memory with a high error rate such as a MRAM or a NAND flash memory, the use of an error correcting code (ECC) is insufficient. Therefore, an additional memory component has been suggested as in the above described conventional technique. However, when a value is incorrectly read from the additional memory component, the read data is wrongly inverted, and an error correction with an ECC cannot be performed. As a result, the reliability of read data is decreased.